from django.db import models
from django.db import models

# Create your models here.

class Contact(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=20)

    address = models.CharField(max_length=200)
    suburb = models.CharField(max_length=40)
    state = models.CharField(max_length=40)
    postcode = models.CharField(max_length=40)
    country = models.CharField(max_length=40)

    email = models.EmailField(blank=True)
    date_added = models.DateTimeField()

    class Meta:
        abstract = False
    def __str__(self):
        """ 
        This is what will be shown in the Admin interface, amongst other 
        places. If we migrate to a later version of django, may want to look
        into using __unicode__ here rather than __str__.
        """
        return "%s %s hash:%s" % (self.first_name, self.last_name, self.__hash__()) 
    def __hash__(self):
        """hash for Contact class. Useful for the set operations involving Contacts"""
        return self.id

class Volunteer(Contact):
    HOURS_CHOICES = (      
    ('monday_am', 'Monday Mornings'),
    ('monday_pm', 'Monday Afternoons'),
    ('tuesday_am', 'Tuesday Mornings'),
    ('tuesday_pm', 'Tuesday Afternoons'),
    )
    INTERESTS = (      
    ('front_desk', 'Front Desk'),
    ('build_room', 'Build Room'),
    ('training', 'Training'),
    ('administration', 'Administration'),
    ('other', 'Other'),
    )
    hours = models.CharField(max_length=10, choices=HOURS_CHOICES)
    interests = models.CharField(max_length=20, choices=INTERESTS)

class Recipient(Contact):
    CONCESSION_TYPES = (
        ('healthcare', 'Healthcare Card'),
        ('student', 'Student'),
        ('other', 'Other'),
    )   
    INTERNET_TYPES = (
        ('none', 'None'),
        ('broadband', 'Broadband'),
        ('dialup', 'Dialup'),
    )   
    concession_type = models.CharField(max_length=10, choices=CONCESSION_TYPES)
    concession_checked_by = models.ForeignKey(Volunteer)
    #referring_org = models.ForeignKey(Group)
    install_windows = models.BooleanField()
    stay_with_linux = models.BooleanField()
    survey_contact = models.BooleanField()
    have_not_used_a_computer = models.BooleanField()
    can_type_documents = models.BooleanField()
    can_use_keyboard_and_mouse = models.BooleanField()
    can_use_email = models.BooleanField()
    can_use_internet = models.BooleanField()
    has_attended_training = models.BooleanField()
    internet_type = models.CharField(max_length=9, choices=INTERNET_TYPES)
    aggression_rating = models.CharField(max_length=30)
    isp = models.CharField(max_length=30, choices=INTERNET_TYPES)

